import React, { Component } from "react";
import { Toast, NoticeBar, Modal } from "antd-mobile";
import { connect } from "react-redux";
import { debounce } from "lodash";
import XFButton from "@/xfCompontent/xfButton/xfButton";
import { InterfaceG, agreements_url } from "@config/Config";
import yhTools from "@tools/yh";
import MainLayout from "@component/mainLayout/mainLayout";
import { getAppPlatformsDatas } from "@redux/Action/nativeDatas/nativeDatas";
import { setOCRInfo } from "@redux/Action/liveness/index";
import BackModal from "@component/backModal/index";
import { xhfAuthAmount } from "@tools/xhf";
import NoCredit from "./component/noCredit";
import UpgradeService from "./component/upgradeService";
import Banner from "@/views/viewCommon/Banner";
import "./xhdHome.scss";
import footer from "@/images/imageXHF/xhf_foot.png";
import titleLogo from "@/images/imagesXHD/title.png";
import HKJL from "@images/imagesXHD/ic_hkjl.png";
import JKJL from "@images/imagesXHD/ic_jkjl.png";
import icProblem from "@images/imagesXHD/ic_problem.png";
import creditStore from "../credit/creditStore";
import ActivityModal from "@component/activityModal";
import decoratorToLoan from "@/component/decoratorToLoan";
import BackPayResultTag from "@/component/backPayResultTag";

const alert = Modal.alert;

@decoratorToLoan
@creditStore
class xhdHome extends Component {
	constructor(props) {
		super(props);
		this.state = {
			maskShow: false, // 霸屏显示
			curXhfKtBPImg: "", // 当前霸屏图谱
			showMsgBox: false,
			btnText: "申请开通",
			status: "",
			flag: true,
			isNeedRepay: "",
			amountState: "",
			boardTitle: "",
			boardContent: "", //小辉贷公告
			modal1: false,
			xhdAmountDTO: {
				availableAmount: "", //可用额度
				creditAmount: "", //授信额度
				maxAmount: "", //最高额度
				dayInterestRate: "--", //日利率,
				minInterestRate: "", //最低日利率
				interestRate: "--" // 年利率
			},
			btnTextObj: {
				0: {
					btnText: "申请开通"
				}, //没有开通
				1: {
					btnText: "我要借钱"
				}, //无贷还期供
				2: {
					btnText: "去还款"
				}, //有贷还期供
				3: {
					btnText: "去还款"
				}, //可用额度为0
				4: {
					btnText: "立即申请"
				}, //授信通过且超过一年
				5: {
					btnText: "额度审核中"
				}
			},
			bannerList: [], //banner列表
			imgUrlData: {}, //未授信banner
			activeVisible: false, //活动弹窗
			activeData: {}, //活动数据
			buttonArray: [],
			cornerContent: "", // 付推广角标内容
			extendState: 0 // 付推广状态0-不推广，1-推广
		};
		this.timer = null;
		this.gotoPayPage = this.gotoPayPage.bind(this);
		this.gotoPages = this.gotoPages.bind(this);
		this.btnFn = debounce(this.btnFn, 500, { leading: true });
		this.fromPage = sessionStorage.getItem("fromPage"); //判断从某页过来，目前对"支付成功页"过来进行判断
	}

	componentDidMount() {
		if (this.props.location.query) {
			this.setState({
				flag: false
			});
		}
		this.getXHDHome();
		this.queryPopupFrameRule();
	}

	componentWillUnmount() {
		clearInterval(this.timer);
	}
	//获取活动弹窗
	queryPopupFrameRule = () => {
		let objs = {
			url: InterfaceG.queryPopupFrameRule,
			params: {
				pageCode: "xhdHomePage",
				productCode: "802"
			},
			_alertShow: false
		};
		yhTools.request(objs).then(res => {
			if (res.code === "0") {
				if (res.data) {
					this.setState({
						activeData: res.data,
						activeVisible: true,
						buttonArray: res.data.buttonArray
							? JSON.parse(res.data.buttonArray)
							: []
					});
				}
			} else {
				Toast.info(res.message, 2);
			}
		});
	};
	//关闭活动弹窗
	onCloseAcitve = () => {
		this.setState({
			activeVisible: false
		});
	};
	//初始化小辉贷首页
	getXHDHome() {
		let objs = {
			url: InterfaceG.xhdInitHomePage,
			params: {
				longitude: this.props.getAppPlatformsDatas.longitude,
				latitude: this.props.getAppPlatformsDatas.latitude
			},
			_alertShow: false
		};
		yhTools.request(objs).then(res => {
			if (res.code === "0") {
				clearInterval(this.timer);
				//state状态 0-未登录，1-未授信，2-已授信 3-已授信超过1年,
				//amountState额度状态 1-未使用 2-部分使用 3-全部使用,
				const {
					state,
					amountState,
					lnid,
					applyNo,
					isNeedRepay,
					xhdAmountDTO = {},
					xhfKtBPImgs = [],
					interestRate,
					dayInterestRate
				} = res.data;
				this.props._getAppPlatformsDatas({
					lnid,
					applyNo
				});
				if (state == "3") {
					this.getNotice();
					this.timer = setInterval(() => {
						this.getXHDHome();
					}, 5000);
				} else if (state == "1") {
					this.getXhdExtendState();
					this.getNotice();
					this.getChannelBannerListNew();
				} else if (state == "2") {
					// 已授信的获取banner
					this.getBannerListByPageType();
					if (amountState == "1") {
						this.getNotice();
					} else {
						this.getNoticeLoan();
					}
				}
				this.setState({
					dayInterestRate,
					interestRate,
					status: state,
					data: res.data,
					isNeedRepay: isNeedRepay,
					xhdAmountDTO: xhdAmountDTO,
					amountState,
					duringtion: xhdAmountDTO.duringtion,
					repaymentInfoDto: res.data.repaymentInfoDto
						? res.data.repaymentInfoDto
						: {},
					curXhfKtBPImg:
						xhfKtBPImgs && xhfKtBPImgs.length > 0 ? xhfKtBPImgs[0] : "", // 霸屏图片
					maskShow: xhfKtBPImgs && xhfKtBPImgs.length > 0 ? xhfKtBPImgs[0] : "" // 是否显示霸屏，存在就直接弹出
				});
				this.setStatus(state, amountState);
			} else {
				Toast.info(res.message, 2);
			}
		});
	}
	//获取banner
	getBannerListByPageType = () => {
		const params = {
			url: InterfaceG.getBannerListByPageType,
			params: {
				pageType: "xhdIndexPage"
			},
			_alertShow: false
		};
		yhTools.request(params).then(res => {
			if (res.code === "0") {
				if (res.data && res.data.length > 0) {
					res.data.forEach(item => {
						if (item.bannerType == "xhdIndexPage_bottemBanner") {
							this.setState({
								bannerList: item.indexServerDtos ? item.indexServerDtos : []
							});
						}
					});
				}
			}
		});
	};
	//获取未授信banner
	getChannelBannerListNew = () => {
		let params = {
			url: InterfaceG.getBannerListByPageType,
			params: {
				pageType: "xhdIndexPage"
			}
		};
		yhTools.request(params).then(res => {
			//预授信区分banner
			const bannerType =
				this.props.getAppPlatformsDatas.lnid == "810"
					? "XHD_NO_CREDIT_NOT_OPEN_PAGE"
					: "xhdIndexPage_middleBanner";
			if (res.code === "0") {
				if (res.data && res.data.length > 0) {
					res.data.forEach(item => {
						if (item.bannerType == bannerType) {
							this.setState({
								imgUrlData: item.indexServerDtos[0]
									? item.indexServerDtos[0]
									: {}
							});
						}
					});
				}
			}
		});
	};
	setStatus(status, amountState) {
		if (status != "1" || status != "3") {
			this.setState({
				status
			});
		}
		if (status == "2") {
			this.setBtnTextByStatus(amountState);
		} else if (status == "1") {
			//1-未授信
			this.setBtnTextByStatus("0");
		} else if (status == "3") {
			//授信中
			this.setBtnTextByStatus("5");
		} else {
			this.setBtnTextByStatus("4");
		}
	}

	//根据状态设置按钮
	setBtnTextByStatus(status) {
		const { btnTextObj } = this.state;
		this.setState({
			btnText: btnTextObj[status].btnText
		});
	}
	//点击去借款
	onBorrow = () => {
		this.props.toLoan({
			availableAmount: this.state.xhdAmountDTO.availableAmount,
			duringtion: this.state.duringtion,
			reminder: this.state.duringtion
		});
	};
	//点击按钮
	btnFn() {
		let state = this.state.status; //状态 0-未登录，1-未授信，2-已授信 3-已授信超过1年
		let amountState = this.state.data.amountState; //1-未使用 2-部分使用 3-全部使用
		console.log("state===", state);
		console.log("amountState===", amountState);
		if (state == "1") {
			//未授信
			this.isHasLocation(() => {
				this.gotoPages();
			});
			// this.gotoPages();
		} else if (state == "2") {
			//已授信
			if (amountState == "1") {
				//amountState 1 表示未使用  为借款功能
				this.props.toLoan({
					availableAmount: this.state.xhdAmountDTO.availableAmount,
					duringtion: this.state.duringtion,
					reminder: this.state.duringtion
				});
			} else if (amountState == "2" || amountState == "3") {
				//amountState 2 3 表示有使用额度  为还款功能
				this.gotoPayPage();
			}
		} else {
			return false;
		}
	}
	gotoPayPage() {
		this.jumpPage("xhdPayBackHome");
	}

	/**获取位置信息*/
	isHasLocation(success) {
		const _this = this;
		let longitude = this.props.longitude || "";
		let latitude = this.props.latitude || "";
		if (!longitude || !latitude) {
			//获取经纬度
			window.YHAuthorize.callHandler("Privacy_Loaction", "", res => {
				// if (res.status == "1000") {
				const { data = {} } = res;
				longitude = data.longitude || "";
				latitude = data.latitude || "";
				_this.props._getAppPlatformsDatas({
					longitude,
					latitude,
					devicesInfo: {
						...this.props.devicesInfo,
						longitude,
						latitude
					}
				});
				success();
				// } else if (res.status == "3001") {
				// 	alert("地理位置授权", "允许永辉金融钱包访问您当前的地理位置信息？", [
				// 		{ text: "取消", onPress: () => {} },
				// 		{ text: "设置", onPress: () => this.openLoction() }
				// 	]);
				// } else {
				// 	Toast.info(res.message, 2);
				// }
			});
		} else {
			success();
		}
	}
	//去设置允许打开地理位置
	openLoction() {
		yhTools.settingPrivacy();
	}
	//领取额度
	gotoPages() {
		let objs = {
			url: InterfaceG.xhdAppBtnOpotion,
			params: {
				longitude: this.props.getAppPlatformsDatas.longitude,
				latitude: this.props.getAppPlatformsDatas.latitude,
				productNo: "802"
			}
		};
		// if (
		// 	!this.props.getAppPlatformsDatas.longitude ||
		// 	!this.props.getAppPlatformsDatas.latitude
		// ) {
		// this.isHasLocation(() => {
		// this.gotoPages();
		// });
		// 	return;
		// }
		Toast.loading("加载中...", 100);
		yhTools.request(objs).then(res => {
			if (res.code === "0") {
				let lnid = res.data.lnid;
				Toast.hide();
				this.props._getAppPlatformsDatas({
					lnid: res.data.lnid,
					applyNo: res.data.applyNo
				});
				if (lnid == "803") {
					Toast.info("你可能持有我司其他信贷产品，不可重复申请", 3);
				} else {
					this.props.getCreditStep(lnid);
				}
			} else {
				Toast.info(res.message, 2);
			}
		});
	}

	//小辉付跳转不同首页
	jumpPage(url, data) {
		this.props.history.push({
			pathname: `/${url}`,
			state: data
		});
	}

	gotoXyPage(type) {
		if (type == "1") {
			//点击查看隐私服务协议
			this.props.history.push({
				pathname: "/iframeAgreements",
				state: {
					src: agreements_url + "/privacyAgreement.html",
					title: "永辉金融隐私政策"
				}
			});
		} else if (type == "3") {
			this.props.history.push("/agreementoflianyintong");
		} else {
			this.props.history.push("/serviceAgreementAuthorization");
		}
	}

	xhdSignApplyLoad() {
		let objs = {
			url: InterfaceG.xhdSignApplyLoad,
			params: {
				productNo: "802"
			}
		};
		Toast.loading("加载中...", 100);
		yhTools.request(objs).then(res => {
			Toast.hide();
			if (res.code == "0") {
				this.sendCode.countdown();
				if (res.data.status == "0") {
					//弹框
					this.setState({
						sendSuccessPhone: res.data.bankMobile,
						showMsgBox: true,
						orderNo: res.data.orderNo
					});
				} else if (res.data.status == "2") {
					alert(
						"",
						"根据国家相关法律要求，需要上传有效期内的身份影像后才可借款",
						[
							{ text: "取消", onPress: () => { } },
							{
								text: "上传身份证照片",
								onPress: () => {
									//跳转上传身份证页面
									this.jumpPage("xhdUpIdCard", {
										availableAmount: this.state.xhdAmountDTO.availableAmount,
										duringtion: this.state.duringtion,
										fromUrl: "xhdHome",
										reminder: this.state.data.reminder,
										name: res.data.account_name
									});
								}
							}
						]
					);
				} else if (res.data.status == "1") {
					this.jumpPage("xhdLoan", {
						availableAmount: this.state.xhdAmountDTO.availableAmount,
						duringtion: this.state.duringtion,
						fromUrl: "xhdHome",
						reminder: this.state.data.reminder
					});
				}
			} else {
				Toast.info(res.message, 2);
			}
		});
	}

	// gotoxhdRecordList() {
	// 	this.props.history.push("/xhdRecordList");
	// }
	/**
	 * @description: 跳转借还款记录
	 * @param {*}type loan:借款  pay：还款
	 */
	goHistory = type => {
		if (type == "loan") {
			// this.props.history.push("/xhdLoanRecordList");
			this.props.history.push({ pathname: "/loanAndPayDetail/0" });
		} else {
			// this.props.history.push("/xhdPayRecordList");
			this.props.history.push({ pathname: "/loanAndPayDetail/1" });
		}
	};
	//关闭验证码弹框
	closeSendModal() {
		this.setState({
			showMsgBox: false
		});
	}

	//短信验证码验证接口
	// sendYzm() {
	// 	this.xhdSignApplyLoad();
	// }

	//提交回调
	submitCode(code) {
		this.xhdSignSubmitByVerifyCode(code);
	}

	xhdSignSubmitByVerifyCode(code) {
		const _this = this;
		let objs = {
			url: InterfaceG.xhdSignSubmitByVerifyCode,
			params: {
				verifyCode: code,
				orderNo: this.state.orderNo
			},
			_alertShow: false
		};
		Toast.loading("加载中...", 100);
		yhTools.request(objs).then(res => {
			if (res.code === "0") {
				_this.setState({
					showMsgBox: false
				});
				_this.jumpPage("xhdLoan", {
					availableAmount: _this.state.xhdAmountDTO.availableAmount,
					duringtion: _this.state.duringtion,
					fromUrl: "xhdHome",
					reminder: _this.state.data.reminder
				});
			} else {
				Toast.info(res.message, 2);
			}
		});
	}
	//获取公告
	getNotice() {
		const params = {
			url: `/fm/boardInfo`,
			header: this.props.getAppPlatformsDatas,
			params: {
				boardType: "00",
				boardSubtype: "xhd"
			},
			_alertShow: false
		};
		yhTools.request(params).then(res => {
			if (res.code == "0") {
				this.setState({
					boardContent: res.data[0] ? res.data[0].boardContent : "",
					boardTitle: res.data[0] ? res.data[0].boardTitle : ""
				});
			}
		});
	}

	//获取公告
	getNoticeLoan() {
		const params = {
			url: `/fm/boardInfo`,
			header: this.props.getAppPlatformsDatas,
			params: {
				boardType: "00",
				boardSubtype: "xhdRepay"
			},
			_alertShow: false
		};
		yhTools.request(params).then(res => {
			if (res.code == "0") {
				this.setState({
					boardContent: res.data[0] ? res.data[0].boardContent : "",
					boardTitle: res.data[0] ? res.data[0].boardTitle : ""
				});
			}
		});
	}

	onClose = key => () => {
		this.setState({
			[key]: false
		});
	};

	// html反转义
	htmlDecode(text) {
		let temp = document.createElement("div");
		temp.innerHTML = text;
		let output = temp.innerText || temp.textContent;
		temp = null;
		return output;
	}

	// 获取存文本
	htmlDecodeToText(text) {
		let htmlText = this.htmlDecode(text);
		htmlText = htmlText
			.replace(/<\/?.+?>/g, "")
			.replace(/\ +/g, "")
			.replace(/[\r\n]/g, "")
			.replace(/&nbsp;/gi, "")
			.replace("&nbsp;", "")
			.replace("&nsp;", "")
			.replace(/\s*/g, "");
		return htmlText;
	}

	// 关闭霸屏
	closeMask() {
		this.setState({ maskShow: false });
	}

	// 去小辉付授信
	xhfSx() {
		yhTools.throttle(xhfAuthAmount.call(this), 1200);
	}

	/**
	 * @description: 未授信组件点击按钮回调
	 */
	onSubmit = () => {
		this.btnFn();
	};
	showModal = () => {
		this.setState({
			isVisible: true
		});
	};
	onModalClick = booleanValue => {
		this.setState({
			isVisible: false
		});
		if (!booleanValue && this.state.flag) {
			if (this.fromPage == "payResult") {
				//如果从支付结果页跳转过来返回支付结果
				this.props.history.push("/payResult");
			} else {
				yhTools.closePage();
			}
		} else if (!booleanValue && !this.state.flag) {
			this.props.history.goBack();
		}
	};

	formatInterestRate = rate => {
		let num = Number(rate.split("%")[0]);
		if (num === 24) {
			return " 24% ";
		} else {
			return (
				<div>
					<span className="zhek">{num + 2 > 24 ? "24" : num + 2}%</span>
					<span className="zhens">{rate}</span>
				</div>
			);
		}
	};

	// 是否推广付
	getXhdExtendState = () => {
		let objs = {
			url: InterfaceG.xhdHomePageGetXhdExtendState,
			params: {}
		};
		Toast.loading("加载中...", 100);
		yhTools.request(objs).then(resp => {
			const { code, data = {}, message } = resp;
			if (code === "0") {
				const { cornerContent = "", extendState } = data;
				this.setState({
					cornerContent,
					extendState
				});
			} else {
				message && Toast.info(message, 2);
			}
		});
	};

	render() {
		const {
			btnText = "",
			status,
			boardTitle,
			xhdAmountDTO = {},
			amountState,
			isVisible,
			bannerList,
			repaymentInfoDto = {},
			imgUrlData,
			activeVisible,
			activeData,
			buttonArray,
			extendState,
			cornerContent
		} = this.state;
		const { repayAmt, repayDate } = repaymentInfoDto;
		let _pageParams = {
			header: {
				title: "小辉贷",
				titleType: titleLogo,
				goBackAction: () => {
					if (this.fromPage === "payResult") {
						//如果从支付结果页进来返回
						this.props.history.push("/payResult");
					} else if (!(status == "1" || status == "3")) {
						yhTools.closePage();
					}
				}
			},
			isModal: status == "1" || status == "3", // 未授信才有挽留页面
			history: this.props.history,
			cacheLifecycles: this.props.cacheLifecycles
		};

		return (
			<>
				<MainLayout pageParams={_pageParams} handleBack={this.showModal}>
					<BackModal
						product={"802"}
						isVisible={isVisible}
						onClick={this.onModalClick}
						isIndex={true}
					/>
					<ActivityModal
						activeVisible={activeVisible}
						onCloseAcitve={this.onCloseAcitve}
						activeData={activeData}
						buttonArray={buttonArray}
						history={this.props.history}
					/>
					{this.state.boardContent && (
						<React.Fragment>
							<NoticeBar
								marqueeProps={{ loop: true, style: { padding: "0 7.5px" } }}
								onClick={() => this.setState({ modal1: true })}
							>
								{this.htmlDecodeToText(this.state.boardContent)}
							</NoticeBar>
						</React.Fragment>
					)}
					{status && (
						<div className="xhd-home">
							{this.state.maskShow && (
								<div className="mask-box">
									<div className="mask-content">
										<img src={this.state.curXhfKtBPImg} alt="" />
										<div className="btn-box">
											<div className="btn" onClick={this.xhfSx.bind(this)}>
												快速激活
											</div>
										</div>
									</div>
									<div className="close-box">
										<div className="close" onClick={this.closeMask.bind(this)}>
											x
										</div>
									</div>
								</div>
							)}
							{status == "1" || status == "3" ? (
								<>
									{/* 判断是否要升级服务 */}
									{status == "1" &&
										this.props.getAppPlatformsDatas.lnid == "811" ? (
										<UpgradeService
											history={this.props.history}
											data={xhdAmountDTO}
											status={status}
											onSubmit={this.onSubmit}
											imgUrlData={imgUrlData}
											extendState={extendState}
											cornerContent={cornerContent}
										/>
									) : (
										<NoCredit
											history={this.props.history}
											data={xhdAmountDTO}
											status={status}
											onSubmit={this.onSubmit}
											imgUrlData={imgUrlData}
											extendState={extendState}
											cornerContent={cornerContent}
											lnid={this.props.getAppPlatformsDatas.lnid}
										/>
									)}
								</>
							) : (
								<div className="box">
									<div className="banner">
										<div className="content">
											<p>可借额度（元）</p>
											<h3>{xhdAmountDTO.availableAmount || "0.00"}</h3>
											<div className="lilv">
												年化利率(单利)
												<div>
													{this.formatInterestRate(xhdAmountDTO.interestRate)}
												</div>
											</div>

											<div className="tow-money">
												<div>
													<p>总额度（元）</p>
													<span>{xhdAmountDTO.creditAmount || "0.00"}</span>
												</div>
												<div
													onClick={() =>
														yhTools.debounceNew(this.gotoPayPage, 500)()
													}
												>
													<p>本期应还（元）&gt;</p>
													<span>{repayAmt || "0.00"}</span>
													<i>{repayDate || "暂无本期应还"}</i>
												</div>
											</div>
											{amountState == "2" ? (
												<div className="xhd-home-btn">
													<div className="btn-content">
														<XFButton
															btnStyle={{
																background: "#ffeeef",
																color: "#F82633",
																width: "2.4rem",
																display: "inline-block"
															}}
															handleBtn={this.onBorrow}
															toLoan
															btText="去借款"
														/>
													</div>
													<div className="btn-content">
														<XFButton
															handleBtn={this.btnFn.bind(this)}
															btText={btnText}
															btnStyle={{
																background: "#ffeeef",
																color: "#F82633",
																width: "2.4rem",
																display: "inline-block"
															}}
														/>
													</div>
												</div>
											) : (
												<div className="xhd-home-btn">
													<XFButton
														handleBtn={this.btnFn.bind(this)}
														btText={btnText}
														btnStyle={{
															background: "#ffeeef",
															color: "#F82633"
														}}
													/>
												</div>
											)}
										</div>
										<ul>
											<li onClick={() => this.goHistory("loan")}>
												<span>
													<img src={HKJL} />
												</span>
												<p>借款记录</p>
											</li>
											<li onClick={() => this.goHistory("pay")}>
												<span>
													<img src={JKJL} />
												</span>
												<p>还款记录</p>
											</li>
											<li onClick={() => this.jumpPage("xhdCommonProblem")}>
												<span>
													<img src={icProblem} />
												</span>
												<p>常见问题</p>
											</li>
										</ul>
										<div className="activity">
											<h1>精选活动</h1>
											<Banner
												bannerList={bannerList}
												history={this.props.history}
											/>
										</div>
										<div className="footer-box">
											<img className="footer" src={footer} alt="" />
										</div>
									</div>
								</div>
							)}
							{/* <SendMSGCode
							ref={ref => {
								this.sendCode = ref;
							}}
							getYZMCode={this.sendYzm.bind(this)}
							sendSuccessPhone={sendSuccessPhone}
							submitCode={this.submitCode.bind(this)}
							closeSendModal={this.closeSendModal.bind(this)}
							showMsgBox={showMsgBox}
						/> */}
						</div>
					)}
					<Modal
						visible={this.state.modal1}
						transparent
						maskClosable={false}
						onClose={this.onClose("modal1")}
						title={boardTitle}
						footer={[
							{
								text: "知道了",
								onPress: () => {
									this.onClose("modal1")();
								}
							}
						]}
						wrapProps={{ onTouchStart: this.onWrapTouchStart }}
						className="xhdhomemodal"
					>
						{
							<div
								className="board-content-box"
								style={{ textAlign: "left" }}
								dangerouslySetInnerHTML={{ __html: this.state.boardContent }}
							></div>
						}
					</Modal>
				</MainLayout>

				{/* MainLayout的-webkit-overflow-scrolling导致zindex失效，单独放到其他其他标签 */}
				{/* 当从支付结果 payResult 过来显示右上角标签供返回 */}
				{this.fromPage === "payResult" ? (
					<BackPayResultTag {...this.props} />
				) : (
					""
				)}
			</>
		);
	}
}

function mapStateToProps(state) {
	return state;
}

function mapDispatchToProps(dispatch) {
	return {
		_getAppPlatformsDatas: abj => {
			//获取native的数据
			dispatch(getAppPlatformsDatas(abj));
		},
		setOCRInfo: abj => {
			dispatch(setOCRInfo(abj));
		}
	};
}

const xhdHomePage = connect(mapStateToProps, mapDispatchToProps)(xhdHome);
export default xhdHomePage;
